header.main {
    position: relative;
    z-index: 9999;
    max-width: 100em;
    margin: 0 auto;
    background: $white;
    padding: 1.5em 5.5% 1.25em;
    transition: padding .3s ease;

    &::before {
        content: "";
        position: absolute;
        z-index: -1;
        display: block;
        top: 0; left: 0; width: 100%; height: 100%;
        background: $white;
        box-shadow: 0 10px 15px -8px rgba($black, 0);
        transform: translate3d(0px, 0px, 0px);
        transition: box-shadow .6s ease;
    }

    .nav--on & {
        &::before {
            box-shadow: 0 10px 15px -8px rgba($black, .1);
        }
    }

    .logo {
        display: flex;
        align-items: center;
        margin-right: auto;

        .mark {
            margin-right: 1.25em;
        }

        .type {
            display: none;
        }
    }

    .search_box {
        position: relative;
        z-index: 10;
        display: flex;
        justify-content: flex-end;
        margin-left: auto;
        flex: 1;

        .input_group {
            padding: 0;
            width: 1em;
            transition: width .5s ease;

            input[type="search"] {
                margin: 0;
                border-bottom-color: $white;

                &:focus {
                    width: 100%;
                    border-bottom-color: $black;
                }
            }

            input[type="text"] {
                margin: 0;
            }

            input[type="submit"] {
                top: .35em;
            }

            &:hover {
                width: 100%;

                input[type="search"] {
                    border-bottom-color: $black;
                }
            }
        }

        &.search--on {
            .input_group {
                width: 100%;

                input[type="search"] {
                    border-bottom-color: $black;
                }
            }
        }
    }

    .header_content {
        display: flex;
        align-items: center;

        .trigger_contain {
            display: block;
            width: 1.3125em;
            margin-left: 2em;

            .nav_trigger {
                left: 0;
            }
        }
    }

    @include fl-break-height(25em) {
        padding: 2em 5.5% 1.5em;
    }

    @include fl-break-height(40em) {
        padding: 2.4375em 5.5% 2em;
    }

    @include fl-break(45em) {
        .logo {
            margin-right: 1.25em;

            .type {
                display: block;
            }
        }
    }

    @include fl-break(72em) {
        padding-top: 2.75em;
        background: none;

        .logo {
            margin-right: 3%;
            transform: translateY(-.25em);
        }

        &::before {
            display: none;
        }

        .search_box {
            position: absolute;
            right: 0;
            flex: initial;
            width: 23%;

            .input_group {
                padding: 0;
                width: 100%;
                transition: width .5s ease;

                input[type="search"] {
                    margin: 0;
                    border-bottom-color: $gray;

                    &:focus {
                        width: 100%;
                        border-bottom-color: $black;
                    }
                }

                input[type="submit"] {
                    top: .35em;
                }

                &:hover {
                    width: 100%;

                    input[type="search"] {
                        border-bottom-color: $black;
                    }
                }
            }

            &.search--on {
                .input_group {
                    width: 100%;

                    input[type="search"] {
                        border-bottom-color: $black;
                    }
                }
            }
        }

        .header_content {
            .trigger_contain {
                display: none;
            }
        }
    }

    @include fl-break(80em) {
        .logo {
            margin-right: 4.5%;
        }
    }
}

nav.main {
    position: absolute;
    z-index: -2;
    top: 100%; left: 0; width: 100%;
    background: $white;
    transform: translateY(-1em);
    box-shadow: 0 20px 30px -16px rgba($black, .2);
    transition: transform .4s ease;

    .nav_contain {
        max-height: 0;
        overflow: scroll;
        -webkit-overflow-scrolling: touch;
        opacity: 0;
        padding: 0 5.5%;
        transform: translateY(-2em);
        transition: opacity .4s ease, max-height .6s ease, transform .4s ease;
    }

    .nav_contain > ul {
        list-style-type: none;
        margin: 0; padding: 2em 0;

        &> li {
            border-bottom: 1px solid rgba($gray, .5);

            &:last-child {
                border-bottom: none;
            }
        }

        li {
            display: block;
            padding: .75em 0;
            text-align: center;

            a {
                position: relative;
                display: block;
                color: $black;
                text-decoration: none;
                -webkit-tap-highlight-color: rgba(0,0,0,0);
                
                &.drop_trigger {
                    display: flex;
                    align-items: center;
                    justify-content: center;

                    .arrow {
                        margin-left: .5em;

                        img {
                            display: block;
                            transition: transform .3s ease;
                        }
                    }
                }

                &:hover {
                    transform: perspective(1px) scale3d(1.03, 1.03, 1.03);
                }
            }

            .drop_contain {
                width: 105%;
                margin-left: -2.5%;
                max-height: 0;
                overflow: hidden;
                transition: max-height .3s ease;
            }

            &.drop--on {
                .drop_trigger {
                    .arrow img {
                        transform: rotate(180deg);
                    }
                }

                .drop_contain {
                    overflow: visible;
                    max-height: 125em;
                }
            }

            ul.ecosystem {
                margin: 0; padding: 1em 0 0;

                li {
                    margin: 0 0 1em;
                    padding: 0 5%;

                    a {
                        display: flex;
                    }
                }
            }
        }
    }

    .nav--on & {
        transform: translateY(0);

        .nav_contain {
            max-height: calc(100vh - 96px);
            transform: translateY(0);
            opacity: 1;
        }
    }

    @include fl-break-height(25em) {
        .nav--on & {
            .nav_contain {
                max-height: calc(100vh - 108px);
            }
        }
    }

    @include fl-break-height(40em) {
        .nav--on & {
            .nav_contain {
                max-height: calc(100vh - 123px);
            }
        }
    }

    @include fl-break(33em) {
        .nav_contain > ul li {
            ul.ecosystem {
                display: flex;
                flex-wrap: wrap;
                justify-content: center;

                li {
                    width: 50%;
                    padding: 0 2.5%;
                }
            }

            &.drop--on {
                .drop_contain {
                    max-height: 58em;
                }
            }
        }
    }

    @include fl-break(40em) {
        .nav_contain > ul li {
            ul.ecosystem {
                display: flex;
                flex-wrap: wrap;
                justify-content: center;

                li {
                    width: 50%;
                    padding: 0 2.5%;

                    a {
                        padding: 1em;

                        .system_icon {
                            width: 3.5em; height: 3.5em;
                            margin-right: 1em;
                        }

                        .system_info {
                            font-size: 1.25em;
                        }
                    }
                }
            }

            &.drop--on {
                .drop_contain {
                    max-height: 58em;
                }
            }
        }
    }

    @include fl-break(45em) {
        .nav_contain {
            padding: 0 calc(5.5% + 2em);
        }

        .nav_contain > ul li {
            &.drop--on {
                .drop_contain {
                    max-height: 70em;
                }
            }
        }
    }

    @include fl-break(58em) {
        .nav_contain > ul li {
            .drop_contain {
                width: 102%;
                margin-left: -1%;
            }

            ul.ecosystem {
                li {
                    width: 33%;
                    padding: 0 1%;
                    margin-bottom: 1.5em;
                }
            }
        }
    }

    @include fl-break(72em) {
        position: static;
        z-index: 1;
        top: auto; left: auto; width: auto;
        background: none;
        transform: translateY(0);
        box-shadow: none;
        transition: none;

        .nav_contain {
            max-height: 100vh;
            overflow: visible;
            opacity: 1;
            padding: 0;
            transform: none;
            transition: none;
            margin-right: 300px;
        }

        .nav_contain > ul {
            display: flex;
            align-items: center;
            padding: 0; margin: 0;

            &> li {
                margin-right: 8.5%;
                border-bottom: none;

                &:last-child {
                    margin-right: 0;
                }
            }

            li {
                position: relative;

                a.drop_trigger .arrow {
                    min-width: 10px;
                }

                .drop_contain {
                    position: absolute;
                    top: 100%; left: 50%;
                    transform: translateX(-50%);
                    margin: 0;
                    width: 55em;
                    box-shadow: 0 20px 30px -16px rgba($black, .2);
                }

                &.active > a::after {
                    content: "";
                    position: absolute;
                    top: calc(100% + .25em); left: 0; right: 0;
                    height: 3px;
                    background: $red;
                }

                &.drop--on {
                    .drop_trigger {
                        .arrow img {
                            transform: rotate(180deg);
                        }
                    }

                    .drop_contain {
                        overflow: hidden;
                        max-height: 55em;

                    }
                }

                ul.ecosystem {
                    background: $white;

                    li {
                        margin: 0 0 1.5em;
                        padding: 0 2%;
                    }
                }
            }
        }

        .partners & {
            .nav_contain > ul > li.partners_link > a::after {
                content: "";
                position: absolute;
                top: calc(100% + .25em); left: 0; right: 0;
                height: 3px;
                background: $red;
            }
        }

        .nav--on & {
            transform: translateY(0);

            .nav_contain {
                max-height: calc(100vh - 96px);
                transform: translateY(0);
                opacity: 1;
            }
        }
    }

    @include fl-break(80em) {
        .nav_contain > ul {
            &> li {
                margin-right: 10%;
            }
        }
    }
}